﻿namespace Homework01
{
    internal class Program
    {
        /// <summary>
        /// 用户输入一个分数，根据分数，分别给出A B C D
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //获得用户输入  类.方法说明这个方法是静态方法
            Console.Write("请输入一个分数（1-100）: ");
            string? userInput = Console.ReadLine();
            //把输入转化成整数
            int score;
            string answer;
            //将userInput通过TryParse转换成Int，如果成功返回True,并将结果存储到score
            if (int.TryParse(userInput, out score) )
            {
                if (score > 90) answer = "A";
                else if (score > 60) answer = "B";
                else if (score > 50) answer = "C";
                else answer = "D";
                Console.WriteLine(answer);
            }
            else
            {
                //转换失败
                Console.WriteLine("非法输入");
            }
            //根据分数给出分级
        }
    }
}
